package com.lpl.util;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;

import java.util.Date;
import java.util.Map;

public class jwts {
    private  static  final  String Key ="xueixfgfy";
    public  static  String genToken( Map<String,Object> clamis){


        return JWT.create().withClaim("clamis",clamis).withExpiresAt(
                new Date(System.currentTimeMillis()+1000*60*60*12)
        ).sign(Algorithm.HMAC256(Key));
    }
//    Map<String, Object>
    public static Map<String, Object> parseToken(String token){
        return JWT.require(Algorithm.HMAC256(Key)).build().verify(token).getClaim("clamis").asMap();
    }



















}
